#include "stdio.h"
#include "stdlib.h"

int main(int argc, char const *argv[])
{

    int *p1 = (int *)malloc(8);
    if (NULL == p1)
    {
        printf("分配内存失败");
        return -1;
    }
    else
    {
        printf("分配内存成功.\n");
        *(p1 + 0) = 2;
        *(p1 + 1) = 3;
        printf("%d %d\n", *p1, *(p1 + 1));
    }
    free(p1);
    p1 = NULL;

    void *p2 = malloc(8);
    if (NULL == p2)
    {
        printf("分配内存失败");
        return -1;
    }
    else
    {
        printf("分配内存成功.\n");
        *(int *)(p2 + 0) = 2;
        *(int *)(p2 + 4) = 3;
        printf("%d %d\n", *(int *)(p2 + 0), *(int *)(p2 + 4));
    }

    free(p2);
    p2 = NULL;

    return 0;
}
